cmake_minimum_required(VERSION 3.20)

###########
# Options #
###########
option(CMakeRIO "Build for RoboRIO" OFF)
option(QUIET "Silences extra build info" OFF)

#############
# Variables #
#############
# Build info
if(CMakeRIO)
    set(CMAKE_TOOLCHAIN_FILE build/cmake/roborio.cmake) # Use RoboRIO tool chain file
endif(CMakeRIO)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") # Required by Wpilib
set(CMAKE_CXX_STANDARD 17) # Wpilib requires c++ 17
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Create a compile_commands.json

# Organize CMake output
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin")
list(APPEND CMAKE_MODULE_PATH
    "${CMAKE_BINARY_DIR}/conan")
list(APPEND CMAKE_PREFIX_PATH
    "${CMAKE_BINARY_DIR}/conan")

### Start editing here!!! ###

##############
# Print info #
##############
set(TEAM_NUMBER 1706)
set(AUTHOR "Team ${TEAM_NUMBER} Programming")
set(VERSION "Beta-0.5")
set(DESCRIPTION "A translation of the robot code for the 2021 off session to c++")
#if(NOT QUIET)
#    message("**************************************************")
#    message("Build for: ${CMAKE_PROJECT_NAME}")
#    message("Author(s): ${AUTHOR}")
#    message("Version: ${VERSION}")
#    message("Description: ${DESCRIPTION}")
#    message("Build Type: ${CMAKE_BUILD_TYPE}")
#    message("WITH_TESTS: ${WITH_TESTS}")
#    message("WITH_TOOLS: ${WITH_TOOLS}")
#    message("CMakeRIO: ${CMakeRIO}")
#    message("**************************************************")
#endif(NOT QUIET)

################
# Project info #
################
project(Control2021cpp)

###########
# Options #
###########
option(WITH_TESTS "Builds test programs" OFF)
option(WITH_TOOLS "Builds developer tools" ON)

##################
# Build projects #
##################
include(${CMAKE_CURRENT_LIST_DIR}/src/robot/CMakeLists.txt)
# You can include other components and projects here

if(WITH_TOOLS)
    # include()'s for tool projects should go here
endif(WITH_TOOLS)

################################
# Wrap scripts in build system #
################################
add_custom_target(example
    COMMAND "bash" "-c" "echo 'hello'"
)
